<template>
  <div>
    <div>
      <div class="title_name">
        <div>金牌经纪人</div>
        <div @click="moreGoldMedal">更多</div>
      </div>
      <div>
        <div class="gold_medal">
          <div class="content" v-for="item in agentListData" @click="goRealtor(item.id)">
            <img v-if="item.photo" :src="item.photo" alt="">
            <div class="name">{{item.account}}</div>
            <div class="address">
              <span class="iconfont icon-ditu"></span>
              <span>{{item.city_code}}</span>
            </div>
            <div class="phone">
              <!--<span class="icon-ditu icon-shouji"></span>-->
              <span>{{item.store_id}}</span>
            </div>
          </div>
          <!--<div class="content">-->
          <!--<img src="../assets/image/agent.png" alt="">-->
          <!--<div class="name">小飞侠</div>-->
          <!--<div class="phone">-->
          <!--<span>易达行</span>-->
          <!--</div>-->
          <!--<div class="address">-->
          <!--<span class="iconfont icon-ditu"></span>-->
          <!--<span>三亚</span>-->
          <!--</div>-->

          <!--</div>-->


        </div>
      </div>
    </div>
  </div>
</template>

<script>
  import {agentList} from '../axios/api';
  import {getCityName} from '../assets/js/cache';

  export default {
    name: 'GoldMedal',
    data() {
      return {
        agentListData: []
      }
    },
    created() {
      this.getAgentList();
    },
    methods: {
      //获取经纪人列表
      getAgentList() {
        let na = 1;
        let page = 1;
        agentList(page,getCityName().CODE,na).then(({data}) => {
          // let i = 0;
          // let jinjiren = [];
          // let jinjirenList = [];
          //
          // for (; i < data.data.length; i++) {
          //   jinjiren.push(data.data[i].adviser_list);
          //
          // }
          //
          // for (let j = 0; j < jinjiren.length; j++) {
          //
          //   if (jinjiren[j].length) {
          //
          //     for (let k = 0; k < jinjiren[j].length; k++) {
          //       jinjirenList.push(jinjiren[j][k])
          //     }
          //   }
          // }
          // this.agentListData = jinjirenList;
          this.agentListData = data.data;
          // console.log('121654165464654');
          // console.log(data);
          // console.log(jinjirenList)
        }).catch(err => {
          console.log(err);
        })
      },
      goRealtor(id) {
        this.$router.push('/RealtorWebsite/' + id);
      },
      //更多经纪人
      moreGoldMedal() {
        this.$router.push({name: 'GoldMedalPage'})
      }
    }
  }
</script>

<style scoped>
  .title_name {
    display: flex;
    justify-content: space-between;
  }

  .gold_medal {
    display: -webkit-box;
    overflow-x: scroll;
    -webkit-overflow-scrolling: touch;
  }

  .gold_medal::-webkit-scrollbar {
    display: none;
  }

  .gold_medal .content {
    width: 6rem;
    padding: 5px;
    background-color: #ffffff;
    border: solid 0.031rem #dddcdc;
    margin: 10px 10px 10px 0;
    font-size: 0.8rem;
    color: #333;

  }

  .gold_medal .content > div {
    height: 1.5rem;
    line-height: 1.5rem;
  }

  .gold_medal img {
    width: 100%;
    /*height: 3.7rem;*/
  }

  .gold_medal .iconfont {
    color: #999;
  }
</style>
